const address = [
  {
    id: 1,
    name: '北京',
    children: [
      {
        id: 11,
        name: '海淀',
        chidlren: [
          {
            id: 111,
            name: '中关村'
          }
        ]
      }, {
        id: 12,
        name: '朝阳',
      }
    ]
  },
  {
    id: 2,
    name: '河北省'
  }
];

// 方案1.把数据扁平化，扁平化以后再去id查找
// 方案2。在原始数据查找，递归
const get = (address, id) => {
  let res = '';
  const next = arr => {
    for(let i = 0; i < arr.length; i++) {
      let item = arr[i];
      if(item.id === id) {
        res = item.name;
        break;
      }
      // 只有有children
      if(Array.isArray(item.chidlren)) next()
    }
  }

  next();

  return res
}